package com.aya.ite.coffee;

import java.util.Iterator;

public class Waitress {
    Dinner dinner;
    PancakeHouse pancakeHouse;
    private Coffee coffee;

    public Waitress(PancakeHouse pancakeHouse, Dinner dinner,Coffee coffee) {
        this.dinner = dinner;
        this.pancakeHouse = pancakeHouse;
        this.coffee = coffee;
    }

    public void printMenu(){
        System.out.println("pancake menu");

        printMenuItems(pancakeHouse.createIterator());

        System.out.println("dinner menu");

        printMenuItems(dinner.createIterator());

        System.out.println("coffee menu");

        printMenuItems(coffee.createIterator());

    }

    private void printMenuItems(Iterator<MenuItem> iterator) {
        while (iterator.hasNext()){
            MenuItem menuItem = iterator.next();
            System.out.print(menuItem.getName()+"\t");
            System.out.print(menuItem.getDescription()+"\t");
            System.out.print(menuItem.getPrice()+"\t");
            System.out.print(menuItem.getVegetarian()+"\n");
        }
    }
}
